<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>操作日志</title>
<link rel="stylesheet" href="../webjars/bootstrap/3.3.7-1/css/bootstrap.css" />
<link rel="stylesheet" href="../static/jquery-easyui-1.5.5.3/themes/material-teal/easyui.css" />
<link rel="stylesheet" href="../static/jquery-easyui-1.5.5.3/themes/icon.css" />
<script src="../static/jquery-easyui-1.5.5.3/jquery.min.js"></script>
<script src="../static/jquery-easyui-1.5.5.3/jquery.easyui.min.js"></script>
<script src="../static/jquery-easyui-1.5.5.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	$(function(){
		$("#t_user").datagrid({
			idField: 'id',
			title: '操作日志列表',
			width: '100%',
			fitColumns: true,
			striped: true,
			loadMsg: '数据正在加载...',
			singleSelect: true,
			rownumbers: true,
			url: 'list',
			columns: [
				[
					{
						field: 'id',
						title: '序号',
						width: 50,
						align: 'center'
					},{
						field: 'date',
						title: '操作时间',
						width: 100,
						align: 'center'
					},{
						field: 'operationName',
						title: '操作名称',
						width: 100,
						align: 'center'
					},{
						field: 'username',
						title: '操作者用户名',
						width: 100,
						align: 'center'
					}
				]
			],
			pagination: true,
			pageSize: 5,
			pageList: [5,10, 20, 25, 50]
		});
		
		//查询
		$('#searchbtn').click(function(){
			$('#t_user').datagrid('load', serializeForm($('#mysearch').form()));
		});
		//清除查询
		$('#clearbtn').click(function(){
			//清空form表单
			$('#mysearch').form('clear');
			$("#t_user").datagrid('load', {});
		});
	});
	//js方法，序列化表单
	function serializeForm(form){
		var obj = {};
		$('#id').val("1");
		$.each(form.serializeArray(), function(index){
			if(obj[this['name']]){
				obj[this['name']] = obj[this['name']] + ',' + this['value'];
			}else{
				obj[this['name']] = this['value'];
			}
		});
		return obj;
	}
</script>
<style type="text/css">
	#ss{
		margin: 20px;
	}
</style>
</head>
<body>
	<div id="ss"> 
		<form id="mysearch" method="post">
			<input type="hidden" name = "id" id="id">
			<div class="col-md-3">			
				<div class="input-group">
					<span class="input-group-addon">操作名称</span>
					<input type="text" class="form-control" name="operationName" placeholder="操作名称">
				</div>
			</div>
			<div class="col-md-3">
				<div class="input-group">
					<span class="input-group-addon">操作者用户名</span>
					<input type="text" class="form-control" name="username" placeholder="操作者用户名">
				</div>
			</div>
			<div class="btn-group">
				<button id="searchbtn" class="btn btn-success"><span class="glyphicon glyphicon-search"></span> 查询</button>
				<button id="clearbtn" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> 清空</button>
			</div>
		</form>
	</div>
	<table id = "t_user"></table>
</body>
</html>